//2009/08/18 17:08:32
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <sstream>
#include <algorithm>

using namespace std;

class BuyingCheap
{
public:
    int thirdBestPrice(vector <int> prices)
    {
		set<int> temp (prices.begin(), prices.end());
		set<int>::iterator it = temp.begin();
		if(temp.size()<3) return -1;
		it++;
		it++;
		return *it;
    }
};
